package com.zzb.projectfactory.controller;

import com.zzb.projectfactory.framework.common.BaseController;
import com.zzb.projectfactory.framework.role.entity.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

/**
 * 首页控制器
 * Created by zhangzhenbin on 17-2-21.
 */
@Controller
@RequestMapping
public class MainController extends BaseController {
    @RequestMapping({"/index","/"})
    public String index(HttpServletRequest request){
        User currentUser = getCurrentUser(request);
        if(currentUser != null) {
            return "redirect:/admin/index";
        } //todo

        return "redirect:/login";
    }

    @RequestMapping("/login")
    public String login(){
        return "login";
    }
}
